<div class="manage-article">
	<ul id="article-tab" class="nav nav-tabs">
		<li class="active" name="s1"><a href="<!--{$article.manage}-->"><i class="fa fa-dashboard"></i> 文章</a></li>
		<li name="s3"><a href="<!--{$article.manage}-->&status=3"><i class="fa fa-minus-circle"></i> 审核中</a></li>
		<li name="s4"><a href="<!--{$article.manage}-->&status=4"><i class="fa fa-times-circle"></i> 未通过</a></li>
		<li name="s2"><a href="<!--{$article.manage}-->&status=2"><i class="fa fa-trash-o"></i> 回收站</a></li>
	</ul>
	<table class="table table-striped">
		<thead>
			<tr>
				<th><span class="label label-info">分类</span> 标题</th>
			</tr>
		</thead>
		<tbody>
			<!--{iCMS:article:list loop="true" page="true" row="12" call="user" total_cache="G" status=$status cid=$cid userid=$user.uid}-->
			<tr id="id-<!--{$article_list.id}-->">
				<td>
					<span>#<!--{$article_list.id}-->#</span>
					<!--{if $article_list.status=="3"}-->
					<span class="label label-danger">审核中</span>
					<!--{/if}-->
					<!--{if $article_list.status=="2"}-->
					<span class="label label-default">回收站</span>
					<!--{/if}-->
					<!--{if $article_list.status=="4"}-->
					<span class="label">未通过审核</span>
					<!--{/if}-->
					<span class="label label-info"><!--{$category[$article_list.ucid].name}--></span>
					<a class="link-title" href="<!--{if $article_list.status=="1"}--><!--{$article_list.url}--><!--{else}-->javascript:;<!--{/if}-->" target="_blank">
						<!--{$article_list.title}-->
					</a>
					<div class="clearfix mt10">
						<span class="fs12">点(<!--{$article_list.hits.count}-->) 评(<!--{$article_list.comments}-->) 顶(<!--{$article_list.good}-->)</span>
						<span class="action">
							<a href="<!--{$article.manage}-->&cid=<!--{$article_list.cid}-->">
								<span class="label label-primary"><!--{$article_list.category.name}--></span>
							</a>
							<a class="btn btn-success btn-sm" href="<!--{$article.edit}-->&id=<!--{$article_list.id}-->" title="编辑文章"><i class="fa fa-edit"></i> 编辑</a>
							<!--{if $article_list.status=="2"}-->
							<a href="javascript:;" class="btn btn-danger btn-sm" data-id="<!--{$article_list.id}-->" data-action="delete" title="彻底删除"><i class="fa fa-times"></i> 删除</a>
							<a href="javascript:;" class="btn btn-default btn-sm" data-id="<!--{$article_list.id}-->" data-action="renew" title="还原"><i class="fa fa-reply-all"></i> 还原</a>
							<!--{else}-->
							<a href="javascript:;" class="btn btn-warning btn-sm" data-id="<!--{$article_list.id}-->" data-action="trash" title="删除到回收站"><i class="fa fa-trash-o"></i> 回收站</a>
							<!--{/if}-->
						</span>
					</div>
				</td>
			</tr>
			<!--{/iCMS}-->
		</tbody>
		<tr>
			<td colspan="5">
				<div class="pagination"><!--{$iCMS.PAGES|method:'current_page():bartext()'}--></div>
				<div class="pagination"><!--{$iCMS.PAGES|method:'show(9)'}--></div>
			</td>
		</tr>
	</table>
</div>
<style>
#article-tab {padding-left: 20px;}
.manage-article .action{float: right;}
.manage-article .action a{margin-left: 10px;}
.manage-article .link-title{color: #337ab7;}
</style>
<script type="text/javascript">
$(function() {
    var tab = $("#article-tab");
    $("li", tab).removeClass("active");
    $("[name=s<!--{$status}-->]", tab).addClass("active");
    $("[data-action]").on('click', function(event) {
        event.preventDefault();
        var param = {
            'id': $(this).attr("data-id"),
            'act': $(this).attr("data-action"),
            'pg': 'article',
            'action': 'manage'
        }
        $.post("<!--{iCMS:router url='user'}-->", param, function(c) {
            if (c.code) {
                $("#id-" + param.id).hide('500', function() {
                    $(this).remove();
                });
            } else {
                iCMS.UI.alert(c.msg);
            }
        }, 'json');
    });
});
</script>
